import sys

sys.path.append('..')

from dataloader.trade_amount_v2 import update_exchange_amount_all_type
from tools.logger import logger
import os
import traceback
from tools.task_monitor import task_to_db,send_error_to_email

if __name__ == '__main__':
    logger.info("开始update_exchange_amount_all_type")
    task_to_db(os.path.basename(__file__), 'update_exchange_amount_all_type')
    try:
        update_exchange_amount_all_type()
    except Exception as e:
        msg = traceback.format_exc()
        logger.info(msg)
        send_error_to_email(script_name=os.path.basename(__file__), func_name="update_exchange_amount_all_type", message=msg)
        raise e
    task_to_db(os.path.basename(__file__), 'update_exchange_amount_all_type', 1)
    logger.info("成功update_exchange_amount_all_type")
